#ifndef BUBBLEWIDGET_H
#define BUBBLEWIDGET_H

#include <QWidget>
#include <QGraphicsDropShadowEffect>
#include <QLabel>
#include <QHBoxLayout>
#include <QPainter>
#include <QTimer>
const int SHADOW_WIDTH = 15;                 // 窗口阴影宽度;
const int TRIANGLE_WIDTH = 15;               // 小三角的宽度;
const int TRIANGLE_HEIGHT = 10;              // 小三角的高度;
const int BORDER_RADIUS = 10;                 // 窗口边角的弧度;


class BubbleWidget : public QWidget
{
    Q_OBJECT
public:
    explicit BubbleWidget(QWidget *parent = 0);

    enum Derection
    {
        left,
        right,
        up,
        down,
        det
    };
    // 设置小三角起始位置;
    void setStartPos(int startX);
    // 设置小三角宽和高;
    void setTriangleInfo(int width, int height);
    void setText(QString s);
    void setDerection(Derection d);
    void SetBackGroundRGB(uchar uR=0 , uchar uG = 166 , uchar uB = 231);
    QString text();
    void  DelayClose(int ms);
    QGraphicsDropShadowEffect* shadowEffect;
protected:
    void paintEvent(QPaintEvent *);
    void mousePressEvent (QMouseEvent *);
    void mouseDoubleClickEvent(QMouseEvent *event);
private:
    // 小三角起始位置;
    int         m_startX;
    // 小三角的宽度;
    int         m_triangleWidth;
    // 小三角高度;
    int         m_triangleHeight;
    Derection   derect;
    QLabel *    lb_text;
    QTimer *    m_pShowTimer;
    float       m_dTransparent;

private slots:
    void onDesalt();

};

#endif // BUBBLEWIDGET_H
